package org.example.gradle.base.config.mq.cdtc;

import gradle.rabbit.common.constants.RabbitTemplateConstant;
import jakarta.annotation.Resource;
import gradle.rabbit.common.mq.cdtc.CdtcDockingQueueConstants;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.QueueBuilder;
import org.springframework.amqp.rabbit.core.RabbitAdmin;
import org.springframework.context.annotation.Configuration;

/**
 * 队列配置
 *
 * @author 1141193930@qq.com
 */
@Configuration
public class CdtcQueueMqConfiguration {

    /**
     * 注入RabbitAdmin
     */
    @Resource(name = RabbitTemplateConstant.PRIMARY_RABBIT_TEMPLATE)
    private RabbitAdmin rabbitAdmin;

    /**
     * 创建 跨境、数字清关回执监听-队列 (monitor)
     */
    public Queue cdtcReturnCrossBorderIbMonitorQueue() {

        Queue queue = QueueBuilder.durable(CdtcDockingQueueConstants.CDTC_RETURN_CROSSBORDER_MONITOR_QUEUE).quorum().build();
        rabbitAdmin.declareQueue(queue);
        return queue;
    }
}
